// Copyright (c) 2012 Ecma International.  All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
es5id: 15.2.3.6-4-438
description: >
    accessor property ([[Get]] is undefined, [[Set]] is undefined,
    value
includes: [propertyHelper.js]
---*/

function Test() {
    var obj = {};

    Object.defineProperty(obj, "prop", {
      get: undefined,
      set: undefined,
      enumerable: true,
      configurable: false
    });
    var desc1 = Object.getOwnPropertyDescriptor(obj, "prop");

    try {
      Object.defineProperty(obj, "prop", {
        configurable: true
      });

      throw new Test262Error("Expected TypeError");
    } catch (e) {
      assert(e instanceof TypeError);

      var desc2 = Object.getOwnPropertyDescriptor(obj, "prop");

      assert.sameValue(desc1.configurable, false);
      assert.sameValue(desc2.configurable, false);


      assert(obj.hasOwnProperty("prop"));
    }
}

// preheat
const NUMBER_OF_PREHEAT = 1;
for (let i = 0; i < NUMBER_OF_PREHEAT; i++) {
    Test();
}

ArkTools.jitCompileAsync(Test);
assert.sameValue(ArkTools.waitJitCompileFinish(Test), true, '[JIT] JIT disabled.');

// test
const NUMBER_OF_TEST = 1; // or 2
for (let i = 0; i < NUMBER_OF_PREHEAT; i++) {
    Test();
}
